﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TEL.ClientClasses.Private;

namespace TEL.ClientClasses
{
    public delegate string StringFromString(string value);

    /// <summary>
    /// Класс события изменения состояния SIP акаунта
    /// </summary>
    public class RegistrationEventArgs : EventArgs
    {
        public RegistrationState State { get; private set; }
        public string Message { get; private set; }
        public RegistrationEventArgs(RegistrationState state, string message)
        {
            State = state;
            Message = message;
        }
    }

    public class CallEventArgs : EventArgs
    {
        public Call Caller { get; private set; }

        public CallEventArgs(Call caller)
        {
            Caller = caller;
        }
    }

    public class SipLineEventArgs : EventArgs
    {
        public SipLine Line { get; private set; }

        public SipLineEventArgs(SipLine caller)
        {
            Line = caller;
        }
    }


    /// <summary>
    /// Класс события посылки информационой строки
    /// </summary>
    public class StringEventArgs : EventArgs
    {
        public string Message { get; private set; }
        public StringEventArgs(string msg)
        {
            Message = msg;
        }
    }

    public class CallHoldArgs : EventArgs
    {
        public string LineCall { get; private set; }
        public bool? IsHold { get; private set; }

        public CallHoldArgs(string lineCall, bool? isHold)
        {
            LineCall = lineCall;
            IsHold = isHold;
        }
    }

    public class ReferEventArgs : EventArgs
    {
        public string LineCallDestination { get; private set; }
        public string NumberPhoneSource { get; private set; }

        public ReferEventArgs(string lineCallDestination, string numberPhoneSource )
        {
            LineCallDestination = lineCallDestination;
            NumberPhoneSource = numberPhoneSource;
        }
    }

    public class SipLinesEventArgs : EventArgs
    {
        public List<SipLine> Lines { get; private set; }

        public SipLinesEventArgs(List<SipLine> sipLine)
        {
            Lines = sipLine;
        }
    }

    public class BoolEventArgs :EventArgs
    {
        public bool Message { get; private set; }

        public BoolEventArgs (bool message)
        {
            Message = message;
        }
    }

    /// <summary>
    /// Событие при нажатии кнопки набора
    /// </summary>
    public class ClickNumberEventArgs : EventArgs
    {
        public byte NumberCode { get; private set; }
        public char NumberCaption { get; private set; }
        public string RegexStr { get; private set; }


        public ClickNumberEventArgs(byte numberCode, char numberCaption, string regexStr)
        {
            NumberCaption = numberCaption;
            NumberCode = numberCode;
            RegexStr = regexStr;
        }
    }

    public class LogEventArgs : EventArgs
    {
        public LogType LogType { get; private set ;}
        public string Info { get; private set; }
        public string Message { get; private set; } 

        public LogEventArgs (LogType logType, string info, string message)
        {
            this.LogType = logType;
            Info = info;
            Message = message;
        }
    }

    public class ErrorEventArgs : EventArgs
    {
        public Exception Error { get; private set; }

        public ErrorEventArgs(Exception error)
        {
            Error = error;
        }
    }

    public class StrErrorEventArgs : ErrorEventArgs
    {
        public string StringError { get; private set; }
        public bool PublishError { get; private set; }

        public StrErrorEventArgs(string stringError, Exception error, bool publishError)
            : base(error)
        {
            StringError = stringError;
            PublishError = publishError;
        }
    }

    public class SipResponseEventArgs : EventArgs
    {
        public string Message { get; private set; }
        public int? StatusCode { get; private set; }

        public SipResponseEventArgs(string message, int? statusCode)
        {
            Message = message;
            StatusCode = statusCode;
        }
    }
}
